import { h } from 'vue';
import { NTag } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    type: 'selection',
  },
  {
    title: '序号',
    key: 'id',
    align: "center",
  },
  {
    title: '优惠券名称',
    key: 'name',
    align: "center",
  },
  {
    title: '属性',
    key: 'type',
    align: "center",
    render(row) {
      return h(
        NTag,
        {
          type: 'info',
        },
        {
          default: () => (row.type == 1 ? '普通宝' : row.type == 2 ? '快充宝' : '未知'),
        },
      );
    }
  },
  {
    title: '减免方式',
    key: 'attr',
    align: "center",
    render(row) {
      return h(
        NTag,
        {
          type: 'info',
        },
        {
          default: () => (row.attr == 1 ? '减免金额' : row.attr == 2 ? '减免时长' : '未知'),
        },
      );
    }
  },
  {
    title: '金额(元)或时长(小时)',
    key: 'minus',
    align: "center",
  },
  {
    title: '数量',
    key: 'num',
    align: "center",
  },
  {
    title: '过期时间',
    key: 'expired_at',
    align: "center",
  },
  {
    title: '创建时间',
    key: 'created_at',
    align: "center",
  }
];
